/**
 * 
 */
package es.cloudcast.server.persistence.dao;

import java.io.Serializable;
import java.util.List;

import es.cloudcast.server.model.BasicModel;
import es.cloudcast.server.persistence.PersistenceException;

/**
 * Advanced DAO interface for querying persistence system 
 * 
 * @author Samuel García Martínez <in0de>
 * @see BasicQueryDAO
 */
public interface AdvancedQueryDAO
	<T extends BasicModel, PK extends Serializable> 
	extends BasicQueryDAO<T, PK> {
	
	/**
	 * Executes a SELECT sql type query, returning all T elements
	 * which match the query criteria.
	 * 
	 * @param sql SELECT sql type query to be executed.
	 * 
	 * @return a {@link List} of type T that matches the query 
	 */
	public List<T> executeSelectSQL(String sql) throws PersistenceException;
	
	/**
	 * Executes an UPDATE sql type query, returning the number of 
	 * affected rows.
	 * 
	 * @param sql UPDATE sql type query to be executed.
	 * 
	 * @return the number of affected rows 
	 */
	public Integer executeUpdateSQL(String sql) throws PersistenceException;
	
}